package com.tool.utils.controller;

import com.tool.utils.FileUploadUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author 酒徒
 * @Version 1.0
 * @data 2025/5/22 14:08
 */
@RestController()
@RequestMapping("/common")
public class CommonController {

    @PostMapping("/upload")
    public String upload(MultipartFile file) throws IOException {
        String baseDir = "D:\\test\\upload";
        String res = FileUploadUtils.upload(baseDir, file);
        System.out.println(res);
        return res;
    }
}
